package xaj.scc.ast;

import java.util.List;

import polyglot.ast.Stmt;
import polyglot.visit.StringPrettyPrinter;

public class ProductionOld_c {
	private String name;
	private List<Stmt> action;
	private List<ProductionElement> list;
	
	public ProductionOld_c(String name, List<ProductionElement> lt, List<Stmt> action) {
		this.name = name;
		this.list = lt;
		this.action = action;
	}
	
	public List<Stmt> getAction() {
		return action;
	}

	public String getLeftSide() {
		return name;
	}

	public List<ProductionElement> getRightSide() {
		return list;
	}

	public String toString() {
		String production = name + " ::=";
		String s;
		for(ProductionElement p : list) {
			s = " " + p;
			production += "\n " + s;
		}
		/*
		production += "\n\t{";
		for(Stmt st : action) {
			s = "\n\t\t" + st;
			production += s;
		}
		*/
		production += "\n\t{:";
		StringPrettyPrinter spp = new StringPrettyPrinter(10);
		for(Stmt st : action) {
			s = "\n\t\t" + spp.toString(st);
			production += s;
		}
		production += "\n\t:}";
		return production;
	}
}
